<template>
	<div>
	    <el-form :model="data.myprocess" label-width="80" :rules="rules" ref="myprocess" >
	      <el-form-item label="流程名称">
	      	<el-input v-model="data.myprocess.ProcessName"/>
	      </el-form-item>
	      <el-form-item label="排序" >
	      	<el-input v-model="data.myprocess.Order" type="number" />
	      </el-form-item>
	      <!-- <el-form-item label="流程描述" >
	      	<el-input v-model="data.myprocess.Desc" />
	      </el-form-item> -->
	        <ElFormItem >
	            <ElButton @click.prevent="submit(myprocess)" type="primary" style="margin-left: 150px;">提交</ElButton>
	        </ElFormItem>
	    </el-form>     
	</div> 
</template>

<script setup lang="ts">
		import { ElMessage, FormInstance } from 'element-plus';
		import { reactive, ref } from 'vue'; 
		import businessapi from "@/api/Businessapi"
		
		const data = reactive({
		    myprocess:{
		        Id: 0,
		        ProcessName: '',
				// Order:'',
		        Desc: '', 
		    }
		})
		const emits  = defineEmits(["CloseDlog"])
	 
		const myprocess = ref<FormInstance>();
		const rules = reactive({
		    ProcessName: [{ required: true, message: '请填写你的业务名称',trigger:'blur' }],
		    Order: [{ required: true, message: "请填写你的排序",trigger:'blur' } ],
			Desc: [{ required: true, message: "请填写你的业务描述",trigger:'blur' } ],
		})
		
		function submit(formEl : FormInstance|undefined){
		    if(!formEl) return;
		    formEl.validate(valida=>{
		        if (valida) {
		           emits('CloseDlog',data.myprocess)
		        }
		    })
		}
		
	
</script>

<style>
</style>